local Config = require("Config")
local MPacketDefine = require("middle.MPacketDefine")
local OperateActChongzhiRank = require("activity.operate.ChongzhiRank")
local ComplexSrvActChongzhiRank = require("activity.complex.ChongzhiRank")
local DateActChongzhiXBackY = require("activity.date.ChongzhiXBackY")
local RoleDBLogic  = require("role.RoleDBLogic")
local MiddleLogic = require("middle.MiddleLogic")

local field = {svrIndex = 1}
function sendPayRecord(uuid, rmb, yb)
    if not Config.IS_MIDDLE then return end
    local db = RoleDBLogic.getDb(uuid, field)
    if db then
      local fd = MiddleLogic.getFDBySvrIndex(db.svrIndex)
      if fd then
        _G.msg_middle_parse.writebegin(fd)
        _G.msg_middle_parse.writeint(MPacketDefine.M2G_PAY)
        _G.msg_middle_parse.writestring(uuid)
        _G.msg_middle_parse.writeint(rmb)
        _G.msg_middle_parse.writeint(yb)
        _G.msg_middle_parse.writeend()
      end
    end
end


function M2G_PAY(uuid, rmb, yb)
    if Config.IS_MIDDLE then
        return
    end
    --游戏服在这里处理跨服充值的记录，注意不要再加yb了哦
    print("m2g_pay, uuid:", uuid, rmb, yb)

    local name = RoleDBLogic.getNameByUuid(uuid)
    if name and yb > 0 then
        OperateActChongzhiRank.onRecharge(uuid, name, yb)
        ComplexSrvActChongzhiRank.onRecharge(uuid, name, yb)
        DateActChongzhiXBackY.onRecharge(uuid, name, yb)
    end

end
